package com.june.springframework.pubsub;

import javax.annotation.Resource;
import javax.jms.Destination;

import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Component;

@Component
public class TopicPublisher {
	
	@Resource
	private JmsTemplate jmsTemplate;
	
	@Resource
	private Destination textTopic;
	
	public void publish(String message) {
		jmsTemplate.send(textTopic, session -> session.createTextMessage(message));
	}
	
}
